import { deleteBodyRequest, deleteRequest, getEventStream, getRequest, postRequest, putRequest } from '@/utils/request.js'

export const questionApi = {
  // 试题
  questionPage: (data) => {
    return postRequest('/v1/admin/question/page', data)
  },
  questionTypeStat: (data) => {
    return postRequest('/v1/admin/question/type/stat', data)
  },
  questionRandom: (data) => {
    return postRequest('/v1/admin/question/random', data)
  },
  questionSave: (data) => {
    return postRequest('/v1/admin/question/save', data)
  },
  questionBatchSave: (data) => {
    return postRequest('/v1/admin/question/batch/save', data)
  },
  questionView: (data) => {
    return getRequest('/v1/admin/question/view', data)
  },
  questionEdit: (data) => {
    return putRequest('/v1/admin/question/edit', data)
  },
  questionDelete: (data) => {
    return deleteRequest('/v1/admin/question/delete', data)
  },
  questionSort: (data) => {
    return putRequest('/v1/admin/question/sort', data)
  },
  questionBatchDelete: (data) => {
    return deleteBodyRequest('/v1/admin/question/delete/batch', data)
  },
  questionMove: (data) => {
    return putRequest('/v1/admin/question/move', data)
  },
  questionCiteList: (data) => {
    return getRequest('/v1/admin/question/cite/list', data)
  },
  questionAiCreate: (data) => {
    return postRequest('/v1/admin/question/ai/create', data)
  },
  questionAiCompletions: (data) => {
    return getEventStream('/v1/admin/question/ai/completions', data)
  },

  // 试卷
  paperPage: (data) => {
    return getRequest('/v1/admin/paper/page', data)
  },
  paperSave: (data) => {
    return postRequest('/v1/admin/paper/save', data)
  },
  paperView: (data) => {
    return getRequest('/v1/admin/paper/view', data)
  },
  paperDetailView: (data) => {
    return getRequest('/v1/admin/paper/detail/view', data)
  },
  paperEdit: (data) => {
    return putRequest('/v1/admin/paper/edit', data)
  },
  paperEditPublishStatus: (data) => {
    return putRequest('/v1/admin/paper/edit/publish/status', data)
  },
  paperSort: (data) => {
    return putRequest('/v1/admin/paper/sort', data)
  },
  paperDelete: (data) => {
    return deleteRequest('/v1/admin/paper/delete', data)
  },
  paperBatchDelete: (data) => {
    return deleteBodyRequest('/v1/admin/paper/delete/batch', data)
  },
  paperMove: (data) => {
    return putRequest('/v1/admin/paper/move', data)
  },
  paperCiteList: (data) => {
    return getRequest('/v1/admin/paper/cite/list', data)
  },
  paperCompose: (data) => {
    return postRequest('/v1/admin/paper/compose', data)
  }
}
